package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Comment;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper {
    @Insert("INSERT INTO comment (content,created,user_id,weibo_id) VALUES (#{content},#{created},#{user_id},#{weibo_id})")
     int insertComment(Comment comment);
    @Delete("DELETE FROM comment WHERE id = #{wid}")
    int deleteById(Long id);
    @Update("UPDATE comment SET id = #{id} ,content = #{content},created = #{created},user_id = #{user_id},weibo_id = #{weibo_id} WHERE id = #{id}")
    void updateById(Comment comment);
    @Select("SELECT content,created,user_id,weibo_id From comment WHERE id = #{wid}")
    Comment selectCommentById1(Long id);
    @Select("SELECT content,created,user_id From comment WHERE weibo_id = #{wid}")
    List<Comment> selectCommentById2(Long wid);
}
